﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GomeeSoft.src.classes.DiaryPages
{
    public partial class UCFramePanel : Panel
    {
        // Variable ***********************************************************************
        #region Variable
        private string text;
        [Browsable(true)]
        [EditorBrowsable(EditorBrowsableState.Advanced)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public override string Text
        {
            get { return text; }
            set { text = value; Invalidate(); }
        }
        #endregion
        // Initialize *********************************************************************
        #region Initialize
        public UCFramePanel()
        {
            InitializeComponent();
        }
        #endregion

        // Resize *************************************************************************
        #region Resize
        private void UCFramePanel_Resize(object sender, EventArgs e)
        {
        }
        #endregion

        // Paint **************************************************************************
        #region Paint
        private void UCFramePanel_Paint(object sender, PaintEventArgs e)
        {
            Color LightBorderColor = Global.GetColor(Global.MonthPageCalendarBorderColor[0]);
            Color DarkBorderColor = Global.GetColor(Global.MonthPageCalendarBorderColor[1]);
            Color BackColor = Global.GetColor(Global.MonthPageCalendarBackColor);
            Pen pen = new Pen(LightBorderColor);
            Point p1 = new Point(0, 0);
            Point p2 = new Point(0, Height - 1);
            e.Graphics.DrawLine(pen, p1, p2);
            p1.Offset(Width - 2, 0);
            p2.Offset(Width - 2, 0);
            e.Graphics.DrawLine(pen, p1, p2);
            p1 = new Point(0, 0);
            p2 = new Point(Width, 0);
            e.Graphics.DrawLine(pen, p1, p2);
            p1.Offset(0, Height - 2);
            p2.Offset(0, Height - 2);
            e.Graphics.DrawLine(pen, p1, p2);

            pen = new Pen(DarkBorderColor);
            p1 = new Point(Width - 3, 3);
            p2 = new Point(100, 3);
            e.Graphics.DrawLine(pen, p1, p2);
            p1 = new Point(p2.X, p2.Y);
            p2.Offset(-17, 17);
            e.Graphics.DrawLine(pen, p1, p2);
            p1 = new Point(1, 20);
            e.Graphics.DrawLine(pen, p1, p2);
            p2 = new Point(1, Height - 1);
            e.Graphics.DrawLine(pen, p1, p2);
            p1 = new Point(Width - 1, Height - 1);
            e.Graphics.DrawLine(pen, p1, p2);
            p2 = new Point(Width - 1, 0);
            e.Graphics.DrawLine(pen, p1, p2);

            SolidBrush b = new SolidBrush(BackColor);
            Point[] area = new Point[6];
            area[0] = new Point(1, 1);
            area[1] = new Point(1, 20);
            area[2] = new Point(83, 20);
            area[3] = new Point(100, 3);
            area[4] = new Point(Width - 2, 3);
            area[5] = new Point(Width - 2, 1);
            e.Graphics.FillPolygon(b, area);

            p1 = new Point(5, 2);
            Font f = new Font(Global.FontTahoma, 10);
            b = new SolidBrush(Color.White);
            e.Graphics.DrawString(Text, f, b, p1);
        }
        #endregion
    }
}
